package com.itlong.cloud.commons;

import com.itlong.cloud.user.property.IPropertyPersonServiceClient;
import com.itlong.cloud.utils.date.DateUtil;
import org.slf4j.Logger;import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.RestController;

import java.util.Calendar;

/**
 * <desc>
 * XXXXXXXXX。
 * </desc>
 *
 * @createDate 2017/10/23
 */
@EnableScheduling // 启用定时任务
@RestController
public class TimeDemo {

    private static Logger LOG = LoggerFactory.getLogger(TimeDemo.class);

    @Autowired
    private IPropertyPersonServiceClient iPropertyPersonServiceClient;

//    @Scheduled(cron = "0/20 * * * * ?") // 每20秒执行一次
    public void scheduler() {
        String result = iPropertyPersonServiceClient.userSayHello("2");
        LOG.info(">>>>>scheduled"+result);
        LOG.info("【定时任务】XXX执行成功，当前时间：" + DateUtil.format(Calendar.getInstance(), "yyyy-MM-dd HH:mm:ss"));
    }
}
